Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21623] Fix compilation warning in Ubuntu 24.04 with -Werror #395

Merged
merged 2 commits into from
Sep 11, 2024

Conversation

richiware
Copy link
Member

@richiware richiware commented Sep 10, 2024

Description

Fix compilation warning in Ubuntu 24.04 with -Werror. The error is:

[ 32%] Building CXX object src/cpp/CMakeFiles/fastdds.dir/fastdds/xtypes/type_representation/TypeObjectUtils.cpp.o 

In file included from /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp:26, 

from /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:15: 

In member function ‘void eprosima::fastcdr::optional<T>::reset(bool) [with T = eprosima::fastdds::dds::xtypes::CompleteTypeDetail]’, 

inlined from ‘eprosima::fastcdr::optional<T>& eprosima::fastcdr::optional<T>::operator=(const eprosima::fastcdr::optional<T>&) [with T = eprosima::fastdds::dds::xtypes::CompleteTypeDetail]’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/install/fastcdr/include/fastcdr/xcdr/optional.hpp:205:14, 

inlined from ‘eprosima::fastdds::dds::xtypes::CompleteCollectionHeader& eprosima::fastdds::dds::xtypes::CompleteCollectionHeader::operator=(const eprosima::fastdds::dds::xtypes::CompleteCollectionHeader&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:14591:34, 

inlined from ‘eprosima::fastdds::dds::xtypes::CompleteMapType& eprosima::fastdds::dds::xtypes::CompleteMapType::operator=(const eprosima::fastdds::dds::xtypes::CompleteMapType&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:16264:34, 

inlined from ‘void eprosima::fastdds::dds::xtypes::CompleteTypeObject::map_type(const eprosima::fastdds::dds::xtypes::CompleteMapType&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:21499:23, 

inlined from ‘static eprosima::fastdds::dds::xtypes::ReturnCode_t eprosima::fastdds::dds::xtypes::TypeObjectUtils::build_and_register_map_type_object(const eprosima::fastdds::dds::xtypes::CompleteMapType&, const std::string&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:1776:25: 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/install/fastcdr/include/fastcdr/xcdr/optional.hpp:112:22: error: ‘*(eprosima::fastcdr::optional<eprosima::fastdds::dds::xtypes::CompleteTypeDetail>*)((char*)&type_object + offsetof(eprosima::fastdds::dds::xtypes::CompleteTypeObject, eprosima::fastdds::dds::xtypes::CompleteTypeObject::<unnamed>) + 16).eprosima::fastcdr::optional<eprosima::fastdds::dds::xtypes::CompleteTypeDetail>::storage_.eprosima::fastcdr::detail::optional_storage<eprosima::fastdds::dds::xtypes::CompleteTypeDetail, void>::engaged_’ may be used uninitialized [-Werror=maybe-uninitialized] 

112 | if (storage_.engaged_) 

| ~~~~~~~~~^~~~~~~~ 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp: In static member function ‘static eprosima::fastdds::dds::xtypes::ReturnCode_t eprosima::fastdds::dds::xtypes::TypeObjectUtils::build_and_register_map_type_object(const eprosima::fastdds::dds::xtypes::CompleteMapType&, const std::string&)’: 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:1775:24: note: ‘type_object’ declared here 

1775 | CompleteTypeObject type_object; 

| ^~~~~~~~~~~ 

In member function ‘void eprosima::fastcdr::optional<T>::reset(bool) [with T = eprosima::fastdds::dds::xtypes::CompleteTypeDetail]’, 

inlined from ‘eprosima::fastcdr::optional<T>& eprosima::fastcdr::optional<T>::operator=(const eprosima::fastcdr::optional<T>&) [with T = eprosima::fastdds::dds::xtypes::CompleteTypeDetail]’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/install/fastcdr/include/fastcdr/xcdr/optional.hpp:205:14, 

inlined from ‘eprosima::fastdds::dds::xtypes::CompleteCollectionHeader& eprosima::fastdds::dds::xtypes::CompleteCollectionHeader::operator=(const eprosima::fastdds::dds::xtypes::CompleteCollectionHeader&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:14591:34, 

inlined from ‘eprosima::fastdds::dds::xtypes::CompleteSequenceType& eprosima::fastdds::dds::xtypes::CompleteSequenceType::operator=(const eprosima::fastdds::dds::xtypes::CompleteSequenceType&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:14907:34, 

inlined from ‘void eprosima::fastdds::dds::xtypes::CompleteTypeObject::sequence_type(const eprosima::fastdds::dds::xtypes::CompleteSequenceType&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:21393:28, 

inlined from ‘static eprosima::fastdds::dds::xtypes::ReturnCode_t eprosima::fastdds::dds::xtypes::TypeObjectUtils::build_and_register_sequence_type_object(const eprosima::fastdds::dds::xtypes::CompleteSequenceType&, const std::string&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:1750:30: 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/install/fastcdr/include/fastcdr/xcdr/optional.hpp:112:22: error: ‘*(eprosima::fastcdr::optional<eprosima::fastdds::dds::xtypes::CompleteTypeDetail>*)((char*)&type_object + offsetof(eprosima::fastdds::dds::xtypes::CompleteTypeObject, eprosima::fastdds::dds::xtypes::CompleteTypeObject::<unnamed>) + 16).eprosima::fastcdr::optional<eprosima::fastdds::dds::xtypes::CompleteTypeDetail>::storage_.eprosima::fastcdr::detail::optional_storage<eprosima::fastdds::dds::xtypes::CompleteTypeDetail, void>::engaged_’ may be used uninitialized [-Werror=maybe-uninitialized] 

112 | if (storage_.engaged_) 

| ~~~~~~~~~^~~~~~~~ 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp: In static member function ‘static eprosima::fastdds::dds::xtypes::ReturnCode_t eprosima::fastdds::dds::xtypes::TypeObjectUtils::build_and_register_sequence_type_object(const eprosima::fastdds::dds::xtypes::CompleteSequenceType&, const std::string&)’: 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:1749:24: note: ‘type_object’ declared here 

1749 | CompleteTypeObject type_object; 

| ^~~~~~~~~~~ 

cc1plus: all warnings being treated as errors 

gmake[2]: *** [src/cpp/CMakeFiles/fastdds.dir/build.make:1168: src/cpp/CMakeFiles/fastdds.dir/fastdds/xtypes/type_representation/TypeObjectUtils.cpp.o] Error 1 

gmake[2]: *** Waiting for unfinished jobs.... 

gmake[1]: *** [CMakeFiles/Makefile2:1086: src/cpp/CMakeFiles/fastdds.dir/all] Error 2 

gmake: *** [Makefile:146: all] Error 2 

--- stderr: fastdds 

In file included from /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/TypeObjectUtils.hpp:26, 

from /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:15: 

In member function ‘void eprosima::fastcdr::optional<T>::reset(bool) [with T = eprosima::fastdds::dds::xtypes::CompleteTypeDetail]’, 

inlined from ‘eprosima::fastcdr::optional<T>& eprosima::fastcdr::optional<T>::operator=(const eprosima::fastcdr::optional<T>&) [with T = eprosima::fastdds::dds::xtypes::CompleteTypeDetail]’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/install/fastcdr/include/fastcdr/xcdr/optional.hpp:205:14, 

inlined from ‘eprosima::fastdds::dds::xtypes::CompleteCollectionHeader& eprosima::fastdds::dds::xtypes::CompleteCollectionHeader::operator=(const eprosima::fastdds::dds::xtypes::CompleteCollectionHeader&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:14591:34, 

inlined from ‘eprosima::fastdds::dds::xtypes::CompleteMapType& eprosima::fastdds::dds::xtypes::CompleteMapType::operator=(const eprosima::fastdds::dds::xtypes::CompleteMapType&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:16264:34, 

inlined from ‘void eprosima::fastdds::dds::xtypes::CompleteTypeObject::map_type(const eprosima::fastdds::dds::xtypes::CompleteMapType&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:21499:23, 

inlined from ‘static eprosima::fastdds::dds::xtypes::ReturnCode_t eprosima::fastdds::dds::xtypes::TypeObjectUtils::build_and_register_map_type_object(const eprosima::fastdds::dds::xtypes::CompleteMapType&, const std::string&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:1776:25: 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/install/fastcdr/include/fastcdr/xcdr/optional.hpp:112:22: error: ‘*(eprosima::fastcdr::optional<eprosima::fastdds::dds::xtypes::CompleteTypeDetail>*)((char*)&type_object + offsetof(eprosima::fastdds::dds::xtypes::CompleteTypeObject, eprosima::fastdds::dds::xtypes::CompleteTypeObject::<unnamed>) + 16).eprosima::fastcdr::optional<eprosima::fastdds::dds::xtypes::CompleteTypeDetail>::storage_.eprosima::fastcdr::detail::optional_storage<eprosima::fastdds::dds::xtypes::CompleteTypeDetail, void>::engaged_’ may be used uninitialized [-Werror=maybe-uninitialized] 

112 | if (storage_.engaged_) 

| ~~~~~~~~~^~~~~~~~ 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp: In static member function ‘static eprosima::fastdds::dds::xtypes::ReturnCode_t eprosima::fastdds::dds::xtypes::TypeObjectUtils::build_and_register_map_type_object(const eprosima::fastdds::dds::xtypes::CompleteMapType&, const std::string&)’: 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:1775:24: note: ‘type_object’ declared here 

1775 | CompleteTypeObject type_object; 

| ^~~~~~~~~~~ 

In member function ‘void eprosima::fastcdr::optional<T>::reset(bool) [with T = eprosima::fastdds::dds::xtypes::CompleteTypeDetail]’, 

inlined from ‘eprosima::fastcdr::optional<T>& eprosima::fastcdr::optional<T>::operator=(const eprosima::fastcdr::optional<T>&) [with T = eprosima::fastdds::dds::xtypes::CompleteTypeDetail]’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/install/fastcdr/include/fastcdr/xcdr/optional.hpp:205:14, 

inlined from ‘eprosima::fastdds::dds::xtypes::CompleteCollectionHeader& eprosima::fastdds::dds::xtypes::CompleteCollectionHeader::operator=(const eprosima::fastdds::dds::xtypes::CompleteCollectionHeader&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:14591:34, 

inlined from ‘eprosima::fastdds::dds::xtypes::CompleteSequenceType& eprosima::fastdds::dds::xtypes::CompleteSequenceType::operator=(const eprosima::fastdds::dds::xtypes::CompleteSequenceType&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:14907:34, 

inlined from ‘void eprosima::fastdds::dds::xtypes::CompleteTypeObject::sequence_type(const eprosima::fastdds::dds::xtypes::CompleteSequenceType&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/include/fastdds/dds/xtypes/type_representation/detail/dds_xtypes_typeobject.hpp:21393:28, 

inlined from ‘static eprosima::fastdds::dds::xtypes::ReturnCode_t eprosima::fastdds::dds::xtypes::TypeObjectUtils::build_and_register_sequence_type_object(const eprosima::fastdds::dds::xtypes::CompleteSequenceType&, const std::string&)’ at /home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:1750:30: 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/install/fastcdr/include/fastcdr/xcdr/optional.hpp:112:22: error: ‘*(eprosima::fastcdr::optional<eprosima::fastdds::dds::xtypes::CompleteTypeDetail>*)((char*)&type_object + offsetof(eprosima::fastdds::dds::xtypes::CompleteTypeObject, eprosima::fastdds::dds::xtypes::CompleteTypeObject::<unnamed>) + 16).eprosima::fastcdr::optional<eprosima::fastdds::dds::xtypes::CompleteTypeDetail>::storage_.eprosima::fastcdr::detail::optional_storage<eprosima::fastdds::dds::xtypes::CompleteTypeDetail, void>::engaged_’ may be used uninitialized [-Werror=maybe-uninitialized] 

112 | if (storage_.engaged_) 

| ~~~~~~~~~^~~~~~~~ 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp: In static member function ‘static eprosima::fastdds::dds::xtypes::ReturnCode_t eprosima::fastdds::dds::xtypes::TypeObjectUtils::build_and_register_sequence_type_object(const eprosima::fastdds::dds::xtypes::CompleteSequenceType&, const std::string&)’: 

/home/runner/work/Fast-DDS-docs/Fast-DDS-docs/src/fastdds/src/cpp/fastdds/xtypes/type_representation/TypeObjectUtils.cpp:1749:24: note: ‘type_object’ declared here 

1749 | CompleteTypeObject type_object; 

| ^~~~~~~~~~~ 

cc1plus: all warnings being treated as errors 

gmake[2]: *** [src/cpp/CMakeFiles/fastdds.dir/build.make:1168: src/cpp/CMakeFiles/fastdds.dir/fastdds/xtypes/type_representation/TypeObjectUtils.cpp.o] Error 1 

gmake[2]: *** Waiting for unfinished jobs.... 

gmake[1]: *** [CMakeFiles/Makefile2:1086: src/cpp/CMakeFiles/fastdds.dir/all] Error 2 

gmake: *** [Makefile:146: all] Error 2 

— 

Failed <<< fastdds [2min 10s, exited with code 2]

Contributor Checklist

  • Commit messages follow the project guidelines.
  • N/A Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • N/A New feature has been documented/Current behavior is correctly described in the documentation.
  • N/A Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

@richiware richiware changed the title Fix compilation warning in Ubuntu 24.04 with -Werror [21623] Fix compilation warning in Ubuntu 24.04 with -Werror Sep 10, 2024
@richiware richiware added this to the v4.0.1 milestone Sep 10, 2024
@github-actions github-actions bot added the ci-pending PR which CI is running label Sep 10, 2024
Signed-off-by: Ricardo González Moreno <[email protected]>
Signed-off-by: Ricardo González Moreno <[email protected]>
@MiguelCompany MiguelCompany added ready-to-merge Ready to be merged. CI and changes have been reviewed and approved. and removed ci-pending PR which CI is running labels Sep 11, 2024
@richiware richiware merged commit c342de3 into master Sep 11, 2024
4 checks passed
@richiware richiware deleted the bugfix/21621 branch September 11, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Ready to be merged. CI and changes have been reviewed and approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants